home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer (Italian) 45 / PC Gamer IT CD 45 2-2.iso / addons / photodraw / NT4SP4 / SP4I386.EXE / iimltihd.asp < prev    next >
Encoding:
Text File  |  1998-10-15  |  8.5 KB  |  365 lines

  1. <%@ LANGUAGE=VBScript %>
  2. <%'Option Explicit %>
  3. <% Response.Expires = 0 %>
  4.  
  5. <% if Session("FONTSIZE") = "" then %>
  6.     <!--#include file="iito.inc"-->
  7. <% else %>
  8.  
  9. <% 
  10. Const L_MULTIPLE_TEXT="Multiple identities for this web site."
  11. Const L_IPADDRESS_TEXT="IP Address"
  12. Const L_IPPORT_TEXT="TCP Port"
  13. Const L_SSLPORT_TEXT="SSL Port"
  14. Const L_HOST_TEXT="Host Header Name"
  15. Const L_ACCESSDENIED_TEXT="Access Denied"
  16. Const L_SELECTITEM_TEXT="Please select an item to delete."
  17. dim listSort
  18.  
  19. listSort = Session("ListSort")
  20.  
  21. function heading(width,thestring,sortstr)
  22.     dim i
  23.     width = width - len(thestring)
  24.     for i = width to 0 step -1
  25.         thestring = thestring & " "
  26.     Next
  27.  
  28.     if listSort and (sortstr <> "") then
  29.         thestring = "<A HREF = " & quote & "javascript:sortList('"& sortstr & "');" & quote & ">" & thestring & "</A>"
  30.     end if
  31.     
  32.     heading = thestring
  33. end function
  34. %>
  35.  
  36. <HTML>
  37. <HEAD>
  38.     <TITLE></TITLE>
  39. </HEAD>
  40.  
  41. <BODY BGCOLOR="#CCCCCC" LINK="#000000" VLINK="#000000" ALINK="navy" TOPMARGIN=10 TEXT="#000000" onLoad="loadList();loadHelp();">
  42. <FORM NAME="userform">
  43.  
  44. <TABLE WIDTH=490 BORDER=0>
  45.     <TR>
  46.         <TD COLSPAN=3 STYLE="font-face: Helv,Arial; font-size:10pt;">
  47.             <FONT FACE="Helv,Arial" SIZE=1>
  48.                 <%= L_MULTIPLE_TEXT %>
  49.                 <BR> 
  50.             </FONT>
  51.         </TD>
  52.     </TR>
  53. </TABLE>
  54.  
  55. <TABLE BORDER=1  BORDERCOLOR="#CCCCCC" BORDERCOLORDARK="#CCCCCC" BORDERCOLORLIGHT="#CCCCCC" CELLSPACING=0 CELLPADDING=2>
  56. <TR>
  57. <TD BORDERCOLOR="#CCCCCC" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#000000" STYLE="font-face: Helv,Arial; font-size:10pt;">
  58. <FONT FACE="Helv,Arial" SIZE=1>
  59.     <% if Session("FONTSIZE")="LARGE" then %>
  60.         <%= heading(36,L_IPADDRESS_TEXT, "ipaddress") %>
  61.     <% else %>
  62.         <%= heading(28,L_IPADDRESS_TEXT, "ipaddress") %>    
  63.     <% end if %>
  64.     </FONT>
  65. </TD>
  66. <TD  BORDERCOLOR="#CCCCCC" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#000000" STYLE="font-face: Helv,Arial; font-size:10pt;">
  67. <FONT FACE="Helv,Arial" SIZE=1>
  68.     <% if Session("FONTSIZE")="LARGE" then %>
  69.         <%= heading(8,L_IPPORT_TEXT, "ipport") %>
  70.     <% else %>
  71.         <%= heading(7,L_IPPORT_TEXT, "ipport") %>    
  72.     <% end if %>        
  73.     </FONT>
  74. </TD>
  75. <TD  BORDERCOLOR="#CCCCCC" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#000000" STYLE="font-face: Helv,Arial; font-size:10pt;">
  76. <FONT FACE="Helv,Arial" SIZE=1>
  77.     <% if Session("FONTSIZE")="LARGE" then %>
  78.         <%= heading(8,L_SSLPORT_TEXT, "sslport") %>
  79.     <% else %>
  80.         <%= heading(10,L_SSLPORT_TEXT, "sslport") %>    
  81.     <% end if %>
  82.     </FONT>    
  83. </TD>
  84. <TD  BORDERCOLOR="#CCCCCC" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#000000" STYLE="font-face: Helv,Arial; font-size:10pt;">
  85. <FONT FACE="Helv,Arial" SIZE=1>
  86.         <% if Session("FONTSIZE")="LARGE" then %>
  87.             <%= heading(40,L_HOST_TEXT, "host") %>
  88.         <% else %>
  89.             <%= heading(30,L_HOST_TEXT, "host") %>
  90.         <% end if %>
  91.     </FONT>    
  92. </TD>
  93. </TR>
  94. </TABLE>
  95. </FORM>
  96.  
  97. <FORM name="hiddenform">
  98.     <INPUT TYPE="hidden" NAME="index" VALUE=0>
  99. </FORM>
  100. </BODY>
  101. <SCRIPT LANGUAGE="JavaScript">
  102.  
  103.  
  104.     function loadHelp(){
  105.         top.title.Global.helpFileName="iipy_27";
  106.     }
  107.  
  108.     function loadList(){
  109.         parent.list.location.href="iimltils.asp";
  110.     }
  111.  
  112.     function addItem(){
  113.         i=cachedList.length
  114.         listFunc.noupdate = true;    
  115.         cachedList[i]=new listObj(i,"","","","");
  116.         cachedList[i].newitem=true;
  117.         cachedList[i].updated=true;
  118.         document.hiddenform.index.value=i;
  119.         loadList();
  120.     }
  121.  
  122.     function delItem(){
  123.  
  124.         if (document.hiddenform.index.value >= 0){
  125.             i=eval(document.hiddenform.index.value);
  126.             listFunc.noupdate = true;                
  127.             cachedList[i].deleted=true;
  128.             cachedList[i].updated=true;
  129.              i=i-1;
  130.             <% 'run through the list to find the Next non-deleted item %>
  131.             for (var j=i; j >=0; j--) {
  132.  
  133.                 if (cachedList[j].deleted){
  134.                 }
  135.                 else{
  136.                     break            
  137.                 }
  138.             }    
  139.  
  140.             document.hiddenform.index.value=j;
  141.  
  142.             loadList();
  143.  
  144.         }
  145.         else{
  146.             alert("<%= L_SELECTITEM_TEXT %>");
  147.         }
  148.     }
  149.     
  150.     function setLastSel(id){
  151.         for (var i=0; i < cachedList.length; i++) {
  152.             if (cachedList[i].id == id){
  153.                 document.hiddenform.index.value = i;
  154.                 return;
  155.             }
  156.         }
  157.         
  158.     }
  159.  
  160.     function sortList(sortby)
  161.         {
  162.         
  163.         i=eval(document.hiddenform.index.value);
  164.         if ( i != -1)
  165.         {
  166.             lastsel = cachedList[i].id
  167.         }
  168.         
  169.         if (sortby != listFunc.sortby)
  170.             {
  171.             listFunc.sortby = sortby;
  172.             listFunc.sortAsc = true;
  173.             }
  174.         else
  175.             {
  176.             listFunc.sortAsc = !listFunc.sortAsc;
  177.             }
  178.             
  179.         var num = parseFloat(cachedList[sortby]);
  180.         
  181.         if (isNaN(num))
  182.             {
  183.             cachedList.sort(sortOrder);
  184.             }
  185.         else
  186.             { 
  187.             cachedList.sort(numOrder);
  188.             }
  189.         if ( i != -1)
  190.         {
  191.             setLastSel(lastsel);
  192.         }
  193.         loadList();
  194.         }
  195.  
  196.     function sortOrder(a,b)
  197.     {
  198.  
  199.         
  200.         if (listFunc.sortAsc){
  201.             astr = a["isSecure"] + a[listFunc.sortby];
  202.             bstr = b["isSecure"] + b[listFunc.sortby];
  203.             
  204.             if (astr.toLowerCase() < bstr.toLowerCase()){
  205.                 return -1;
  206.             }
  207.             else{
  208.                 if (astr.toLowerCase() > bstr.toLowerCase()){
  209.                     return 1;
  210.                 }
  211.                 else{
  212.                     return 0;
  213.                 }
  214.             }            
  215.         }
  216.         else{
  217.             astr = !a["isSecure"] + a[listFunc.sortby];
  218.             bstr = !b["isSecure"] + b[listFunc.sortby];
  219.             
  220.             if (astr.toLowerCase() < bstr.toLowerCase()){
  221.                 return 1;
  222.             }
  223.             else{
  224.                 if (astr.toLowerCase() > bstr.toLowerCase()){
  225.                     return -1;
  226.                 }
  227.                 else{
  228.                     return 0;
  229.                 }
  230.             }
  231.         }
  232.     }
  233.     
  234.     function reSort(){
  235.         //set our sortAsc so we aren't just reversing the list...
  236.         listFunc.sortAsc = !listFunc.sortAsc;
  237.         sortList(listFunc.sortby);
  238.     }
  239.     
  240.     function buildListForm(){
  241.         numrows=0;
  242.         for (var i=0; i < cachedList.length; i++) {
  243.             numrows=numrows + 1;
  244.         }
  245.         qstr="numrows="+numrows;
  246.         qstr=qstr+"&cols=ServerBindings&cols=SecureBindings"
  247.  
  248.         top.hlist.location.href="iihdn.asp?"+qstr;
  249.         <% 'the list values will be grabbed by the hiddenlistform script... %>
  250.     }
  251.  
  252.     function SetListVals(){
  253.         listForm=top.hlist.document.hiddenlistform;
  254.         j=0;
  255.         var bindings = "";
  256.         first=true;
  257.         for (var i=0; i < cachedList.length; i++) {
  258.             if (!cachedList[i].deleted){
  259.                 if (first)
  260.                 {
  261.                     top.opener.document.userform.hdnPort.value= cachedList[i].ipport;
  262.                     top.opener.document.userform.hdnIPA.value= cachedList[i].ipaddress;
  263.                     top.opener.document.userform.hdnHost.value= cachedList[i].host;
  264.                     first = false;
  265.                 }
  266.                 if (cachedList[i].sslport != ""){    
  267.                     listForm.elements[j++].value="";
  268.                     listForm.elements[j++].value=cachedList[i].ipaddress+":"+cachedList[i].sslport +":"+cachedList[i].host;
  269.                 }
  270.                 else{
  271.                     bindings += (cachedList[i].ipaddress+":"+cachedList[i].ipport+":"+cachedList[i].host + ",");
  272.                     listForm.elements[j++].value=cachedList[i].ipaddress+":"+cachedList[i].ipport+":"+cachedList[i].host;
  273.                     listForm.elements[j++].value="";
  274.                 }
  275.             }
  276.             cachedList[i].updated=false; 
  277.         }
  278.         top.opener.document.userform.ServerBindings.value = bindings
  279.  
  280.     }
  281.  
  282.     function listFuncs(){
  283.         this.bHasList = true;
  284.         this.sortList = sortList;
  285.         this.reSort = reSort;        
  286.         this.sortby = "ipaddress";
  287.         this.sortAsc = true;
  288.         this.addItem=addItem;
  289.         this.delItem=delItem;
  290.         this.writeList=buildListForm;
  291.         this.SetListVals=SetListVals;
  292.         this.mainframe = top.opener.top;        
  293.         this.lastSel = 0;
  294.         this.noupdate = false;
  295.     }
  296.  
  297.     function listObj(id,ia,ip,sp,hn){
  298.         this.id = id;
  299.         this.isSecure = (sp != "");
  300.         this.ipaddress=ia;
  301.         this.ipport=ip;
  302.         this.sslport=sp;
  303.         this.host=hn;
  304.         this.deleted=false;
  305.         this.newitem=false;
  306.         this.updated=false;
  307.     }
  308.     listFunc=new listFuncs();
  309.     cachedList=new Array()
  310.  
  311. <!--#include file="iibind.inc"-->
  312.         
  313. <%  
  314.  
  315.     On Error Resume Next 
  316.  
  317.     Dim path, currentobj
  318.     Dim aBinding, ssl, arraybound, Binding, SecureBinding
  319.     Dim barraysize, added, i, j, nexti
  320.     
  321.     path=Session("spath")
  322.     Session("path")=path
  323.     Session("SpecObj")=path
  324.     Session("SpecProps")="ServerBindings"    
  325.     Set currentobj=GetObject(path)
  326.  
  327.  
  328.      Redim aBinding(UBound(currentobj.ServerBindings))
  329.      Redim ssl(UBound(currentobj.SecureBindings))    
  330.     
  331.     aBinding=currentobj.ServerBindings
  332.     ssl=currentobj.SecureBindings
  333.  
  334.     if not IsArray(ssl) then
  335.         ssl=Array(1)
  336.         ssl(0)=currentobj.SecureBindings
  337.     end if
  338.  
  339.     nexti=0
  340.     arraybound=UBound(aBinding)
  341.     if aBinding(0) = "" then
  342.         aBinding(0) = ":80:"
  343.     end if
  344.     for i=0 to arraybound
  345.         Binding=getBinding(aBinding(i))
  346.          %>cachedList[<%= i %>]=new listObj(<%= i %>,"<%= Binding(0) %>","<%= Binding(1) %>","","<%= Binding(2) %>");<%          
  347.     Next
  348.     nexti = i
  349.  
  350.     arraybound=UBound(ssl)
  351.     for each secitem in ssl
  352.         SecureBinding=getBinding(secitem)
  353.         %>cachedList[<%= nexti %>]=new listObj(<%= nexti %>,"<%= SecureBinding(0) %>","","<%= SecureBinding(1) %>","<%= SecureBinding(2) %>");<%  
  354.         nexti=nexti + 1    
  355.     Next
  356.  %>
  357.  
  358.  
  359.  
  360.  
  361. </SCRIPT>
  362.  
  363. </HTML>
  364.  
  365. <% end if %>